package demo14;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();
        int month = scanner.nextInt();
        int date = scanner.nextInt();

        int day = 0;
        int m = month-1;
        switch(m) {
            case 12:
                day = day + 31;
            case 11:
                day = day + 30;
            case 10:
                day = day + 31;
            case 9:
                day = day + 30;
            case 8:
                day = day + 31;
            case 7:
                day = day + 31;
            case 6:
                day = day + 30;
            case 5:
                day = day + 31;
            case 4:
                day = day + 30;
            case 3:
                day = day + 31;
            case 2: {
                if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
                    day = day + 29;
                }else {
                    day = day + 28;
                }
            }
            case 1:
                day = day + 31;

        }
        day = day + date;
        System.out.println(day);

    }
}
